import {param2Obj} from '@/utils'

const userMap = {
  // admin: {
  //   roles: ['admin', 'sw'],
  //   token: 'admin',
  //   introduction: '我是超级管理员',
  //   avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
  //   name: 'Super Admin'
  // },
  admin: {
    data: {
      cookie: 'f2342342342342'
    },
    msg: '',
    retcode: 0,
    status: 200
  },
}
const loginInfo = {
  data: {
    Position: {
      id: 1,
      name: 'admin',
      slug: 'admin'
    },
    user: {
      avator: '',
      id: 1,
      name: '二狗',
      remember_token: '',
      username: 'ergou'
    }
  },
  msg: '成功',
  retcode: 0,
  status: 200
}


export default {
  loginByUsername: config => {
    // const { username } = JSON.parse(config.body)
    const username = 'admin'
    return userMap[username]
  },
  getUserInfo: config => {
    const {token} = param2Obj(config.url)
    return loginInfo
  },
  logout: () => 'success'
}
